#include <stdio.h>
#include "Game.h"
#include "Defines.h"

const int FPS = 60;
const int DELAY_TIME = 1000.0f/ FPS;

int main(int argc, char* args[])
{
	Uint32 framestart, frametime;
	Game::Instance()->Initialize("SDL Engine", 100, 100, SCREEN_WIDTH, SCREEN_HEIGHT, false);

	while (Game::Instance()->Running())
	{
		framestart = SDL_GetTicks();
		Game::Instance()->EventHandler();
		Game::Instance()->Update();
		Game::Instance()->Render();

		frametime = SDL_GetTicks() - framestart;

		if(frametime < DELAY_TIME)
		{
			SDL_Delay((int)(DELAY_TIME - frametime));
		}
	}

	return 0;
}
